Fix xm save command for a inactive managed domain.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 9 Jul 2007 08:41:45 +0000 (09:41 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 9 Jul 2007 08:41:45 +0000 (09:41 +0100)
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
tools/python/xen/xend/XendDomain.py
tools/python/xen/xm/main.py

index 5820bc566cf542c5b0eccbb7ee0f623b0d79891e..502199114b133363bceb3cdb000fa48fc9252d55 100644 (file)
@@ -1253,7 +1253,11 @@ class XendDomain:
                 raise XendInvalidDomain(str(domid))
 
             if dominfo.getDomid() == DOM0_ID:
-                raise XendError("Cannot save privileged domain %i" % domid)
+                raise XendError("Cannot save privileged domain %s" % str(domid))
+            if dominfo._stateGet() != DOM_STATE_RUNNING:
+                raise VMBadState("Domain is not running",
+                                 POWER_STATE_NAMES[DOM_STATE_RUNNING],
+                                 POWER_STATE_NAMES[dominfo._stateGet()])
 
             oflags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC
             if hasattr(os, "O_LARGEFILE"):
index 7f93373bd74c7f797c46d4458e6bd41dc1cec833..646f796633c64dd4c1784145f5d54ce417653998 100644 (file)
@@ -700,13 +700,7 @@ def xm_save(args):
     if serverType == SERVER_XEN_API:       
         server.xenapi.VM.save(get_single_vm(dom), savefile, checkpoint)
     else:
-        try:
-            dominfo = parse_doms_info(server.xend.domain(dom))
-        except xmlrpclib.Fault, ex:
-            raise ex
-    
-        domid = dominfo['domid']
-        server.xend.domain.save(domid, savefile, checkpoint)
+        server.xend.domain.save(dom, savefile, checkpoint)
     
 def xm_restore(args):
     arg_check(args, "restore", 1, 2)